package com.red.mybatisSecond;

import org.apache.ibatis.session.SqlSession;

import com.red.dao.StudentDao;
import com.red.util.SqlSessionFactoryUtil;


public class Chapter4_7_1Main {

	public static void main(String[] args) {
		SqlSession sqlSession = null;
		try {
			sqlSession=SqlSessionFactoryUtil.openSqlSession();
			StudentDao studentDao=sqlSession.getMapper(StudentDao.class);
			System.out.println(studentDao.getStudent(1));
			sqlSession.commit();
		} catch (Exception e) {
			e.printStackTrace();
			sqlSession.rollback();
		}finally {
			if(sqlSession!=null) {
				sqlSession.close();
			}
		}
		
	}

}
